import { Button } from "antd";
import { memo, use, useMemo, useState } from "react";
function getCount(num) {
  let count = 0;
  console.time("getCount");
  for (let i = 0; i < num * 100000000; i++) {
    count += i;
  }
  console.timeEnd("getCount");
  return count;
}
// function Example() {
//   const [num, setNum] = useState(0);
//   // const getExpensive = getCount(num);
//   const useMemoCalc = useMemo(() => {
//     return getCount(num);
//   }, [num]);
//   return (
//     <div>
//       <Button onClick={() => setNum(num + 1)}>{num}</Button>
//       {/* {getExpensive} */}
//       {useMemoCalc}
//     </div>
//   );
// }
function Bpp() {
  console.log("bpp render ");
  return <div>bpp</div>;
}
const BppMome = memo(() => <Bpp />);
export default function test() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <Button onClick={() => setCount(count + 1)}>{count}</Button>
      {/* <Example /> */}
      <BppMome />
      {/* <Bpp/>、 */}
    </div>
  );
}
